<template>
  <div>
    <van-sticky>
    <van-nav-bar title="我的收藏"  left-arrow
  @click-left="onClickLeft" /></van-sticky>
  <van-list
    v-model="loading"
    :finished="finished"
    finished-text="没有更多了"
    @load="onLoad"
  >
    <HouseMessage v-for="(rows,index) in collectList" :key="index" :rows="rows"/>
     </van-list>
  </div>
</template>

<script>
import HouseMessage from '@/components/HouseMessage.vue'
import { getFavorites } from '@/api/user'
export default {
  components: {
    HouseMessage
  },
  async created () {
    const { body } = await getFavorites()
    this.collectList = body
    console.log(this.collectList)
  },
  data () {
    return {
      collectList: [],
      loading: false,
      finished: false
    }
  },
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    },
    onLoad () {
      setTimeout(() => {
        if (this.refreshing) {
          this.refreshing = false
        }
        this.loading = false
      }, 1000)
    }
  }
}
</script>

<style></style>
